Skip to contentSkip to conversation

nfs-utils atomicio.c

DISCUSSION Jim Rees 3 participants 9 messages Jul 16, 2010 – Jul 19, 2010 7 messages not in the archive

Subsystems (2)
lore
Share & tools
lore

Jim Rees

author
#0 lore raw

Someone should move atomicio.c into nfs-utils/support/nfs. There are currently two copies, in idmapd and spnfsd, and I'm about to add a third. I'll move it if no one has a better idea or beats me to it.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw
Quoted 3 lines · Jim Rees

Someone should move atomicio.c into nfs-utils/support/nfs. There are currently two copies, in idmapd and spnfsd, and I'm about to add a third. I'll move it if no one has a better idea or beats me to it.

I agree with this move as I have a label mapping daemon based off of idmapd which uses it as well (although not merged yet). My patch set actually moves this file to support/nfs as well.

Dave

A message that is not in the archive (sent off-list or not yet received): 1279310952.8180.0.camel-88+Bj4OksMGWPftkNcioYDMZycKHmlmlfvIqQ387n9k@public.gmane.org

author
#4 lore raw

David P. Quigley wrote:

I agree with this move as I have a label mapping daemon based off of idmapd which uses it as well (although not merged yet). My patch set actually moves this file to support/nfs as well.

I don't suppose you'd like to isolate just the move and submit that?

strlcat and strlcpy should probably go too.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#6 lore raw
Quoted 7 lines · Jim Rees

David P. Quigley wrote:

I agree with this move as I have a label mapping daemon based off of idmapd which uses it as well (although not merged yet). My patch set actually moves this file to support/nfs as well.

I don't suppose you'd like to isolate just the move and submit that?

I'll take care of it...

Quoted 2 lines

strlcat and strlcpy should probably go too.

Anything else?

steved.

A message that is not in the archive (sent off-list or not yet received): [email protected]

author
#8 lore raw
Quoted 1 line · Steve Dickson

strlcat and strlcpy should probably go too.

Anything else?

I don't see any other library functions that should move. Configure should check for strlcat and strlcpy, and not compile them if there are system versions. Again, I'll do that if no one beats me to it.

On a related note, I've been using benny's pnfs-nfs-utils.git tree as a base for adding the block layout helper, as suggested by the wiki. Is that correct?

A message that is not in the archive (sent off-list or not yet received): [email protected]

#10 lore raw
Quoted 5 lines · Jim Rees
Quoted 1 line · Steve Dickson

strlcat and strlcpy should probably go too.

Anything else?

Quoted 7 lines

I don't see any other library functions that should move. Configure should check for strlcat and strlcpy, and not compile them if there are system versions. Again, I'll do that if no one beats me to it.

On a related note, I've been using benny's pnfs-nfs-utils.git tree as a base for adding the block layout helper, as suggested by the wiki. Is that correct?

Just got back from dinner and I'm heading out soon for the weekend but here is the patch that I have. It should apply on top of 2ef57222b10a91f4b96a06808d05a47e8f4c14f7 and moves strlcat and strlcpy as well. The only think you might have to check is I know at some point some changes were made to cfg.c and cfg.h make sure the ones I have in this patch are the new ones instead of the old ones. I'd take a closer look but I'm short on time here.

Dave

Quoted 1 line

From a370d18feae6e1f99183a3da1e290fcea3b697e0 Mon Sep 17 00:00:00 2001

From: David P. Quigley <[email protected]>
Date: Tue, 22 Jun 2010 12:35:27 -0400
Subject: [PATCH] Move common code into support

There are several source files and headers present in the ./utils/idmapd directory which are also usable in a doimapd daemon. Because of this we move that support into the support directory such that it can be shared by both daemons.

---
 {utils/idmapd => support/include}/cfg.h   |    7 +++++++
 support/include/nfslib.h                  |    5 +++++
 {utils/idmapd => support/include}/queue.h |    0
 support/nfs/Makefile.am                   |    3 ++-
 {utils/idmapd => support/nfs}/atomicio.c  |    0
 {utils/idmapd => support/nfs}/cfg.c       |    0
 {utils/idmapd => support/nfs}/strlcat.c   |    0
 {utils/idmapd => support/nfs}/strlcpy.c   |    0
 utils/idmapd/Makefile.am                  |    8 +-------
 utils/idmapd/idmapd.c                     |   11 -----------
 10 files changed, 15 insertions(+), 19 deletions(-)
 rename {utils/idmapd => support/include}/cfg.h (95%)
 rename {utils/idmapd => support/include}/queue.h (100%)
 rename {utils/idmapd => support/nfs}/atomicio.c (100%)
 rename {utils/idmapd => support/nfs}/cfg.c (100%)
 rename {utils/idmapd => support/nfs}/strlcat.c (100%)
 rename {utils/idmapd => support/nfs}/strlcpy.c (100%)
support/include/cfg.h renamed from utils/idmapd/cfg.h +7 -0
similarity index 95%
rename from utils/idmapd/cfg.h
rename to support/include/cfg.h
index c1ca940..aa39acf 100644
@@ -35,6 +35,13 @@
 
 #include "queue.h"
 
+/* From Niels */
+#define CONF_SAVE(w, f) do {			\
+	char *p = f;				\
+	if (p != NULL)				\
+		(w) = p;			\
+} while (0)
+
 struct conf_list_node {
 	TAILQ_ENTRY(conf_list_node) link;
 	char	*field;
support/include/nfslib.h +5 -0
index 422b012..aaa9e4b 100644
@@ -155,4 +155,9 @@ void closeall(int min);
 int			svctcp_socket (u_long __number, int __reuse);
 int			svcudp_socket (u_long __number, int __reuse);
 
+/* Misc shared code prototypes */
+size_t  strlcat(char *, const char *, size_t);
+size_t  strlcpy(char *, const char *, size_t);
+ssize_t atomicio(ssize_t (*f) (int, void*, size_t),
+		 int, void *, size_t);
 #endif /* NFSLIB_H */
support/include/queue.h renamed from utils/idmapd/queue.h +0 -0
similarity index 100%
rename from utils/idmapd/queue.h
rename to support/include/queue.h
support/nfs/Makefile.am +2 -1
index 87f3949..a9753ed 100644
@@ -4,7 +4,8 @@ noinst_LIBRARIES = libnfs.a
 libnfs_a_SOURCES = exports.c rmtab.c xio.c rpcmisc.c rpcdispatch.c \
 		   xlog.c xcommon.c wildmat.c nfssvc.c nfsclient.c \
 		   nfsexport.c getfh.c nfsctl.c \
-		   svc_socket.c cacheio.c closeall.c nfs_mntent.c
+		   svc_socket.c cacheio.c closeall.c nfs_mntent.c \
+		   cfg.c atomicio.c strlcpy.c strlcat.c
 
 MAINTAINERCLEANFILES = Makefile.in
 
support/nfs/atomicio.c renamed from utils/idmapd/atomicio.c +0 -0
similarity index 100%
rename from utils/idmapd/atomicio.c
rename to support/nfs/atomicio.c
support/nfs/cfg.c renamed from utils/idmapd/cfg.c +0 -0
similarity index 100%
rename from utils/idmapd/cfg.c
rename to support/nfs/cfg.c
support/nfs/strlcat.c renamed from utils/idmapd/strlcat.c +0 -0
similarity index 100%
rename from utils/idmapd/strlcat.c
rename to support/nfs/strlcat.c
support/nfs/strlcpy.c renamed from utils/idmapd/strlcpy.c +0 -0
similarity index 100%
rename from utils/idmapd/strlcpy.c
rename to support/nfs/strlcpy.c
utils/idmapd/Makefile.am +1 -7
index eb393df..3f2acac 100644
@@ -13,15 +13,9 @@ EXTRA_DIST = \
 	idmapd.conf
 
 idmapd_SOURCES = \
-	atomicio.c \
-	cfg.c \
 	idmapd.c \
-	strlcat.c \
-	strlcpy.c \
 	\
-	cfg.h \
-	nfs_idmap.h \
-	queue.h
+	nfs_idmap.h
 
 idmapd_LDADD = -levent -lnfsidmap ../../support/nfs/libnfs.a
 
utils/idmapd/idmapd.c +0 -11
index 6b5971c..73187bb 100644
@@ -90,13 +90,6 @@
 #define NFS4NOBODY_GROUP "nobody"
 #endif
 
-/* From Niels */
-#define CONF_SAVE(w, f) do {			\
-	char *p = f;				\
-	if (p != NULL)				\
-		(w) = p;			\
-} while (0)
-
 #define IC_IDNAME 0
 #define IC_IDNAME_CHAN  NFSD_DIR "/nfs4.idtoname/channel"
 #define IC_IDNAME_FLUSH NFSD_DIR "/nfs4.idtoname/flush"
@@ -141,10 +134,6 @@ static int nfsdopen(void);
 static int nfsdopenone(struct idmap_client *);
 static void nfsdreopen(void);
 
-size_t  strlcat(char *, const char *, size_t);
-size_t  strlcpy(char *, const char *, size_t);
-ssize_t atomicio(ssize_t (*f) (int, void*, size_t),
-		 int, void *, size_t);
 void    mydaemon(int, int);
 void    release_parent(void);
 
Signature · 1 line
1.6.2.5

A message that is not in the archive (sent off-list or not yet received): 1279319622.8180.2.camel-88+Bj4OksMGWPftkNcioYDMZycKHmlmlfvIqQ387n9k@public.gmane.org

#12 lore raw

Hey David,

Quoted 14 lines · David P. Quigley
Quoted 5 lines · Jim Rees
Quoted 1 line · Steve Dickson

strlcat and strlcpy should probably go too.

Anything else?

Quoted 7 lines

I don't see any other library functions that should move. Configure should check for strlcat and strlcpy, and not compile them if there are system versions. Again, I'll do that if no one beats me to it.

On a related note, I've been using benny's pnfs-nfs-utils.git tree as a base for adding the block layout helper, as suggested by the wiki. Is that correct?

Quoted 7 lines

Just got back from dinner and I'm heading out soon for the weekend but here is the patch that I have. It should apply on top of 2ef57222b10a91f4b96a06808d05a47e8f4c14f7 and moves strlcat and strlcpy as well. The only think you might have to check is I know at some point some changes were made to cfg.c and cfg.h make sure the ones I have in this patch are the new ones instead of the old ones. I'd take a closer look but I'm short on time here.

Thanks for being so proactive... but... there is no utils/idmapd/cfg.[ch] files in my upstream repo... so where is that coming from??

steved.

#13 lore raw
In reply to a message not in the archive
Quoted 14 lines · David P. Quigley
Quoted 5 lines · Jim Rees
Quoted 1 line · Steve Dickson

strlcat and strlcpy should probably go too.

Anything else?

Quoted 7 lines

I don't see any other library functions that should move. Configure should check for strlcat and strlcpy, and not compile them if there are system versions. Again, I'll do that if no one beats me to it.

On a related note, I've been using benny's pnfs-nfs-utils.git tree as a base for adding the block layout helper, as suggested by the wiki. Is that correct?

Quoted 9 lines

Just got back from dinner and I'm heading out soon for the weekend but here is the patch that I have. It should apply on top of 2ef57222b10a91f4b96a06808d05a47e8f4c14f7 and moves strlcat and strlcpy as well. The only think you might have to check is I know at some point some changes were made to cfg.c and cfg.h make sure the ones I have in this patch are the new ones instead of the old ones. I'd take a closer look but I'm short on time here.

Question: Is there a reason need a private version of queue.h, instead of using the one ins /usr/include/sys?

steved.

A message that is not in the archive (sent off-list or not yet received): [email protected]

#15 lore raw
Quoted 25 lines · Steve Dickson
Quoted 14 lines · David P. Quigley
Quoted 5 lines · Jim Rees
Quoted 1 line · Steve Dickson

strlcat and strlcpy should probably go too.

Anything else?

Quoted 7 lines

I don't see any other library functions that should move. Configure should check for strlcat and strlcpy, and not compile them if there are system versions. Again, I'll do that if no one beats me to it.

On a related note, I've been using benny's pnfs-nfs-utils.git tree as a base for adding the block layout helper, as suggested by the wiki. Is that correct?

Quoted 9 lines

Just got back from dinner and I'm heading out soon for the weekend but here is the patch that I have. It should apply on top of 2ef57222b10a91f4b96a06808d05a47e8f4c14f7 and moves strlcat and strlcpy as well. The only think you might have to check is I know at some point some changes were made to cfg.c and cfg.h make sure the ones I have in this patch are the new ones instead of the old ones. I'd take a closer look but I'm short on time here.

Quoted 4 lines

Question: Is there a reason need a private version of queue.h, instead of using the one ins /usr/include/sys?

steved.

Hello Steve,
At one point there was a cfg.c and cfg.h for idmapd. That was
probably when I first made this patch a year or so ago. I use guilt for patch management so I've been rebasing those patches onto newer versions for a while. Its possible that those files were moved or removed since then. I think I remember hearing that someone redid the config files for nfs. If that is the case cfg.c and cfg.h can go away. It is very possible that they were just rolled forward with the patch rebasing. Additionally if queue.h from /usr/include/sys is what is being used now we can get rid of the private copy from my patch as well. I didn't have a reason for keeping a private copy other than the fact the idmapd was using it and I was going to as well so I moved it into the support directory. I should have given the patch a bit more of a look over before I left for the weekend but I was running really short on time when I sent it out.

Dave