From 3fbbdc856c09828da4d94d992797ba509361b6ae Mon Sep 17 00:00:00 2001 From: Nathan Scott Date: Mon, 2 Jun 2003 04:11:24 +0000 Subject: [PATCH] xfsprogs update to tidy up some libhandle code --- VERSION | 2 +- debian/changelog | 4 +- doc/CHANGES | 5 +++ libhandle/Makefile | 4 +- libhandle/handle.c | 94 ++++++++++++---------------------------------- 5 files changed, 35 insertions(+), 74 deletions(-) diff --git a/VERSION b/VERSION index 00178f9a8..eca795626 100644 --- a/VERSION +++ b/VERSION @@ -3,5 +3,5 @@ # PKG_MAJOR=2 PKG_MINOR=4 -PKG_REVISION=11 +PKG_REVISION=12 PKG_BUILD=0 diff --git a/debian/changelog b/debian/changelog index 4fea2e152..56e79fd52 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,8 @@ -xfsprogs (2.4.11-1) unstable; urgency=low +xfsprogs (2.4.12-1) unstable; urgency=low * New upstream release - -- Nathan Scott Fri, 30 May 2003 14:57:17 +1000 + -- Nathan Scott Mon, 2 Jun 2003 13:51:06 +1000 xfsprogs (2.4.10-1) unstable; urgency=low diff --git a/doc/CHANGES b/doc/CHANGES index 6e0f3012f..f74be89bd 100644 --- a/doc/CHANGES +++ b/doc/CHANGES @@ -1,3 +1,8 @@ +xfsprogs-2.4.12 (02 June 2003) + - Fix xfs_logprint handling of any version 2 log device. + - Remove calls to exit in libhandle, propogate errors to + caller, and bumped libhandle version from 1.0.1 to 1.0.2. + xfsprogs-2.4.11 (30 May 2003) - Extract device sector size at mkfs time and issue warnings if the requested filesystem sector size is too small. diff --git a/libhandle/Makefile b/libhandle/Makefile index 898ec6f5e..155ad481b 100644 --- a/libhandle/Makefile +++ b/libhandle/Makefile @@ -1,5 +1,5 @@ # -# Copyright (c) 2000-2002 Silicon Graphics, Inc. All Rights Reserved. +# Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. # # This program is free software; you can redistribute it and/or modify it # under the terms of version 2 of the GNU General Public License as @@ -35,7 +35,7 @@ include $(TOPDIR)/include/builddefs LTLIBRARY = libhandle.la LT_CURRENT = 1 -LT_REVISION = 1 +LT_REVISION = 2 LT_AGE = 0 CFILES = handle.c jdm.c diff --git a/libhandle/handle.c b/libhandle/handle.c index 4433dc768..dd6949bec 100644 --- a/libhandle/handle.c +++ b/libhandle/handle.c @@ -56,19 +56,8 @@ typedef union { char *path; } comarg_t; -static int -obj_to_handle ( - char *fspath, - int fsfd, - unsigned int opcode, - comarg_t obj, - void **hanp, - size_t *hlen); - -static int -handle_to_fsfd ( - void *hanp, - char **path); +static int obj_to_handle(char *, int, unsigned int, comarg_t, void**, size_t*); +static int handle_to_fsfd(void *, char **); /* @@ -86,10 +75,10 @@ struct fdhash { char fspath[MAXPATHLEN]; }; -static struct fdhash *fdhash_head = NULL; +static struct fdhash *fdhash_head; int -path_to_fshandle ( +path_to_fshandle( char *path, /* input, path to convert */ void **hanp, /* output, pointer to data */ size_t *hlen) /* output, size of returned data */ @@ -100,17 +89,12 @@ path_to_fshandle ( struct fdhash *fdhp; fd = open(path, O_RDONLY); - - if (fd < 0) { - perror(path); - exit(1); - } + if (fd < 0) + return -1; obj.path = path; - result = obj_to_handle(path, fd, XFS_IOC_PATH_TO_FSHANDLE, obj, hanp, hlen); - if (result >= 0) { fdhp = malloc(sizeof(struct fdhash)); if (fdhp == NULL) { @@ -132,9 +116,8 @@ path_to_fshandle ( return result; } - int -path_to_handle ( +path_to_handle( char *path, /* input, path to convert */ void **hanp, /* output, pointer to data */ size_t *hlen) /* output, size of returned data */ @@ -144,24 +127,18 @@ path_to_handle ( comarg_t obj; fd = open(path, O_RDONLY); - - if (fd < 0) { - perror(path); - exit(1); - } + if (fd < 0) + return -1; obj.path = path; - - result = obj_to_handle (path, fd, XFS_IOC_PATH_TO_HANDLE, obj, hanp, hlen); - + result = obj_to_handle(path, fd, XFS_IOC_PATH_TO_HANDLE, + obj, hanp, hlen); close(fd); - return result; } - int -handle_to_fshandle ( +handle_to_fshandle( void *hanp, size_t hlen, void **fshanp, @@ -169,20 +146,14 @@ handle_to_fshandle ( { if (hlen < FSIDSIZE) return EINVAL; - - *fshanp = malloc (FSIDSIZE); - + *fshanp = malloc(FSIDSIZE); if (*fshanp == NULL) return ENOMEM; - *fshlen = FSIDSIZE; - memcpy(*fshanp, hanp, FSIDSIZE); - return 0; } - static int handle_to_fsfd(void *hanp, char **path) { @@ -194,12 +165,12 @@ handle_to_fsfd(void *hanp, char **path) return fdhp->fsfd; } } + errno = EBADF; return -1; } - static int -obj_to_handle ( +obj_to_handle( char *fspath, int fsfd, unsigned int opcode, @@ -236,13 +207,11 @@ obj_to_handle ( } memcpy(*hanp, hbuf, (int) *hlen); - return 0; } - int -open_by_handle ( +open_by_handle( void *hanp, size_t hlen, int rw) @@ -251,10 +220,8 @@ open_by_handle ( char *path; xfs_fsop_handlereq_t hreq; - if ((fd = handle_to_fsfd(hanp, &path)) < 0) { - errno = EBADF; + if ((fd = handle_to_fsfd(hanp, &path)) < 0) return -1; - } hreq.fd = 0; hreq.path = NULL; @@ -268,7 +235,7 @@ open_by_handle ( } int -readlink_by_handle ( +readlink_by_handle( void *hanp, size_t hlen, void *buf, @@ -278,11 +245,8 @@ readlink_by_handle ( char *path; xfs_fsop_handlereq_t hreq; - - if ((fd = handle_to_fsfd(hanp, &path)) < 0) { - errno = EBADF; + if ((fd = handle_to_fsfd(hanp, &path)) < 0) return -1; - } hreq.fd = 0; hreq.path = NULL; @@ -307,10 +271,8 @@ attr_multi_by_handle( char *path; xfs_fsop_attrmulti_handlereq_t amhreq; - if ((fd = handle_to_fsfd(hanp, &path)) < 0) { - errno = EBADF; + if ((fd = handle_to_fsfd(hanp, &path)) < 0) return -1; - } amhreq.hreq.fd = 0; amhreq.hreq.path = NULL; @@ -339,10 +301,8 @@ attr_list_by_handle( char *path; xfs_fsop_attrlist_handlereq_t alhreq; - if ((fd = handle_to_fsfd(hanp, &path)) < 0) { - errno = EBADF; + if ((fd = handle_to_fsfd(hanp, &path)) < 0) return -1; - } alhreq.hreq.fd = 0; alhreq.hreq.path = NULL; @@ -361,7 +321,7 @@ attr_list_by_handle( } int -fssetdm_by_handle ( +fssetdm_by_handle( void *hanp, size_t hlen, struct fsdmidata *fsdmidata) @@ -370,11 +330,8 @@ fssetdm_by_handle ( char *path; xfs_fsop_setdm_handlereq_t dmhreq; - - if ((fd = handle_to_fsfd(hanp, &path)) < 0) { - errno = EBADF; + if ((fd = handle_to_fsfd(hanp, &path)) < 0) return -1; - } dmhreq.hreq.fd = 0; dmhreq.hreq.path = NULL; @@ -389,11 +346,10 @@ fssetdm_by_handle ( return xfsctl(path, fd, XFS_IOC_FSSETDM_BY_HANDLE, &dmhreq); } -/*ARGSUSED*/ void -free_handle ( +free_handle( void *hanp, size_t hlen) { - free (hanp); + free(hanp); } -- 2.47.2