Date: Thu, Feb 16 2006 14:17:46 +1100
From: Tim Shimmin <tes@sgi.com>
References: SGI:PV949664
Subject: fix parents interface

Get rid of cursor and more parameters for getparents functions.
Slight function namechange at the same time.

================================================================================
--- include/handle.h
+++ include/handle.h
@@ -24,7 +24,6 @@
 
 struct fsdmidata;
 struct attrlist_cursor;
-struct parent_cursor;
 struct parent;
 
 extern int  path_to_handle (char *__path, void **__hanp, size_t *__hlen);
@@ -41,14 +40,12 @@
 extern int  attr_list_by_handle (void *__hanp, size_t __hlen, void *__buf,
 				 size_t __bufsize, int __flags,
 				 struct attrlist_cursor *__cursor);
-extern int  getparents_by_handle(void *__hanp, size_t __hlen,
-				 struct parent *__buf, size_t __bufsize,
-				 struct parent_cursor *__cursor,
-				 unsigned int *__count, unsigned int *__more);
-extern int  getparentpaths_by_handle(void *__hanp, size_t __hlen,
-				     struct parent *__buf, size_t __bufsize,
-				     struct parent_cursor *__cursor,
-				     unsigned int *__count, unsigned int *__more);
+extern int  parents_by_handle(void *__hanp, size_t __hlen,
+			      struct parent *__buf, size_t __bufsize,
+			      unsigned int *__count);
+extern int  parentpaths_by_handle(void *__hanp, size_t __hlen,
+				  struct parent *__buf, size_t __bufsize,
+				  unsigned int *__count);
 extern int  fssetdm_by_handle (void *__hanp, size_t __hlen,
 			       struct fsdmidata *__fsdmi);
 
--- include/jdm.h
+++ include/jdm.h
@@ -24,7 +24,6 @@
 
 struct xfs_bstat;
 struct attrlist_cursor;
-struct parent_cursor;
 struct parent;
 
 extern jdm_fshandle_t *
@@ -63,18 +62,16 @@
 		struct attrlist_cursor *cursor);
 
 extern int
-jdm_getparents( jdm_fshandle_t *fshp,
+jdm_parents( jdm_fshandle_t *fshp,
 		xfs_bstat_t *statp,
 		struct parent *bufp, size_t bufsz,
-		struct parent_cursor *cursor,
-		unsigned int *count, unsigned int *more);
+		unsigned int *count);
 
 extern int
-jdm_getparentpaths( jdm_fshandle_t *fshp,
+jdm_parentpaths( jdm_fshandle_t *fshp,
 		xfs_bstat_t *statp,
 		struct parent *bufp, size_t bufsz,
-		struct parent_cursor *cursor,
-		unsigned int *count, unsigned int *more);
+		unsigned int *count);
 
 /* macro for determining the size of a structure member */
 #define sizeofmember( t, m )	sizeof( ( ( t * )0 )->m )
--- libhandle/handle.c
+++ libhandle/handle.c
@@ -370,86 +370,28 @@
 }
 
 int
-getparents_by_handle(
+parents_by_handle(
 	void		*hanp,
 	size_t		hlen,
 	parent_t	*buf,
 	size_t		bufsiz,
-	parent_cursor_t *cursor,
-	unsigned int	*count,
-	unsigned int	*more)
+	unsigned int	*count)
+	
 {
-#if !defined(__sgi__)
 	errno = EOPNOTSUPP;
 	return -1;
-#else
-
-	int		error, fd;
-	char		*path;
-	xfs_fsop_getparents_handlereq_t gphreq;
-
-	if ((fd = handle_to_fsfd(hanp, &path)) < 0)
-		return -1;
-
-	gphreq.hreq.fd       = 0;
-	gphreq.hreq.path     = NULL;
-	gphreq.hreq.oflags   = O_LARGEFILE;
-	gphreq.hreq.ihandle  = hanp;
-	gphreq.hreq.ihandlen = hlen;
-	gphreq.hreq.ohandle  = NULL;
-	gphreq.hreq.ohandlen = NULL;
-	memcpy(&gphreq.pos, cursor, sizeof(gphreq.pos));
-	gphreq.buflen = bufsiz;
-	gphreq.buffer = buf;
-	gphreq.ocount = count;
-	gphreq.omore = more;
-
-	error = xfsctl(path, fd, XFS_IOC_GETPARENTS, &gphreq);
-
-	memcpy(cursor, &gphreq.pos, sizeof(gphreq.pos));
-	return error;
-#endif
 }
 
 int
-getparentpaths_by_handle(
+parentpaths_by_handle(
 	void		*hanp,
 	size_t		hlen,
 	parent_t	*buf,
 	size_t		bufsiz,
-	parent_cursor_t *cursor,
-	unsigned int	*count,
-	unsigned int	*more)
+	unsigned int	*count)
 {
-#if !defined(__sgi__)
 	errno = EOPNOTSUPP;
 	return -1;
-#else
-	int		error, fd;
-	char		*path;
-	xfs_fsop_getparents_handlereq_t gphreq;
-
-	if ((fd = handle_to_fsfd(hanp, &path)) < 0)
-		return -1;
-
-	gphreq.hreq.fd       = 0;
-	gphreq.hreq.path     = NULL;
-	gphreq.hreq.oflags   = O_LARGEFILE;
-	gphreq.hreq.ihandle  = hanp;
-	gphreq.hreq.ihandlen = hlen;
-	gphreq.hreq.ohandle  = NULL;
-	gphreq.hreq.ohandlen = NULL;
-	memcpy(&gphreq.pos, cursor, sizeof(gphreq.pos));
-	gphreq.buflen = bufsiz;
-	gphreq.buffer = buf;
-	gphreq.ocount = count;
-	gphreq.omore = more;
-
-	error = xfsctl(path, fd, XFS_IOC_GETPARENTPATHS, &gphreq);
-
-	memcpy(cursor, &gphreq.pos, sizeof(gphreq.pos));
-	return error;
-#endif
 }
 
 int
--- libhandle/jdm.c
+++ libhandle/jdm.c
@@ -174,43 +174,21 @@
 }
 
 int
-jdm_getparents( jdm_fshandle_t *fshp,
+jdm_parents( jdm_fshandle_t *fshp,
 		xfs_bstat_t *statp,
 		parent_t *bufp, size_t bufsz,
-		parent_cursor_t *cursor,
-		unsigned int *count, unsigned int *more)
+		unsigned int *count)
 {
-#if !defined(__sgi__)
 	errno = EOPNOTSUPP;
 	return -1;
-#else
-	register fshandle_t *fshandlep = ( fshandle_t * )fshp;
-	filehandle_t filehandle;
-
-	jdm_fill_filehandle( &filehandle, fshandlep, statp );
-	return getparents_by_handle (( void * )&filehandle,
-			sizeof( filehandle ),
-			bufp, bufsz, cursor, count, more);
-#endif
 }
 
 int
-jdm_getparentpaths( jdm_fshandle_t *fshp,
+jdm_parentpaths( jdm_fshandle_t *fshp,
 		xfs_bstat_t *statp,
 		parent_t *bufp, size_t bufsz,
-		parent_cursor_t *cursor,
-		unsigned int *count, unsigned int *more)
+		unsigned int *count)
 {
-#if !defined(__sgi__)
 	errno = EOPNOTSUPP;
 	return -1;
-#else
-	register fshandle_t *fshandlep = ( fshandle_t * )fshp;
-	filehandle_t filehandle;
-
-	jdm_fill_filehandle( &filehandle, fshandlep, statp );
-	return getparentpaths_by_handle (( void * )&filehandle,
-			sizeof( filehandle ),
-			bufp, bufsz, cursor, count, more);
-#endif
 }
