* [PATCH 0/2] xfsprogs: Replace deprecated ustat and sig(relse/hold) glibc APIs
@ 2012-03-01 21:11 Kamal Dasu
2012-03-01 21:11 ` [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c Kamal Dasu
0 siblings, 1 reply; 5+ messages in thread
From: Kamal Dasu @ 2012-03-01 21:11 UTC (permalink / raw)
To: xfs
Replacing deprecated APis with new ones.
[PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c
[PATCH 2/2] xfsprogs: Use Posix signal API signprocmask instead of sigrelse/sighold in xfs_copy.c
Kamal
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c
2012-03-01 21:11 [PATCH 0/2] xfsprogs: Replace deprecated ustat and sig(relse/hold) glibc APIs Kamal Dasu
@ 2012-03-01 21:11 ` Kamal Dasu
2012-03-01 21:11 ` [PATCH 2/2] xfsprogs: Use Posix signal API signprocmask instead of sigrelse/sighold in xfs_copy.c Kamal Dasu
2012-03-02 7:45 ` [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c Christoph Hellwig
0 siblings, 2 replies; 5+ messages in thread
From: Kamal Dasu @ 2012-03-01 21:11 UTC (permalink / raw)
To: xfs; +Cc: Kamal Dasu
>From the ustat man page
NOTES
ustat() is deprecated and has only been provided for compatibility.
All new programs should use statfs(2) instead.
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
---
libxfs/linux.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/libxfs/linux.c b/libxfs/linux.c
index 2e07d54..b8cc028 100644
--- a/libxfs/linux.c
+++ b/libxfs/linux.c
@@ -21,7 +21,9 @@
#include <mntent.h>
#include <sys/stat.h>
#undef ustat
-#include <sys/ustat.h>
+#include <sys/statfs.h>
+#include <sys/types.h>
+
#include <sys/mount.h>
#include <sys/ioctl.h>
#include <sys/sysinfo.h>
@@ -50,7 +52,7 @@ int
platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
{
/* Pad ust; pre-2.6.28 linux copies out too much in 32bit compat mode */
- struct ustat ust[2];
+ struct statfs fst;
struct stat64 st;
if (!s) {
@@ -61,7 +63,7 @@ platform_check_ismounted(char *name, char *block, struct stat64 *s, int verbose)
s = &st;
}
- if (ustat(s->st_rdev, ust) >= 0) {
+ if (statfs(block, &fst) >= 0) {
if (verbose)
fprintf(stderr,
_("%s: %s contains a mounted filesystem\n"),
--
1.7.5.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] xfsprogs: Use Posix signal API signprocmask instead of sigrelse/sighold in xfs_copy.c
2012-03-01 21:11 ` [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c Kamal Dasu
@ 2012-03-01 21:11 ` Kamal Dasu
2012-03-02 7:45 ` [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c Christoph Hellwig
1 sibling, 0 replies; 5+ messages in thread
From: Kamal Dasu @ 2012-03-01 21:11 UTC (permalink / raw)
To: xfs; +Cc: Kamal Dasu
From sigrelse and sighold man page
DESCRIPTION
These functions are provided in glibc as a compatibility interface for
programs that make use of the historical System V signal API. This API
is obsolete: new applications should use the POSIX signal API (sigac‐
tion(2), sigprocmask(2), etc.)
Signed-off-by: Kamal Dasu <kdasu.kdev@gmail.com>
---
copy/xfs_copy.c | 17 ++++++++++++++---
1 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/copy/xfs_copy.c b/copy/xfs_copy.c
index c01e0b9..69c85bd 100644
--- a/copy/xfs_copy.c
+++ b/copy/xfs_copy.c
@@ -71,6 +71,17 @@ xfs_off_t write_log_header(int fd, wbuf *w, xfs_mount_t *mp);
#define PRE 0x08 /* append strerror string */
#define LAST 0x10 /* final message we print */
+
+void
+signal_maskfunc(int addset, int newset)
+{
+ sigset_t set;
+
+ sigemptyset(&set);
+ sigaddset(&set, addset);
+ sigprocmask(newset, &set, NULL);
+}
+
void
do_message(int flags, int code, const char *fmt, ...)
{
@@ -478,9 +489,9 @@ write_wbuf(void)
if (target[i].state != INACTIVE)
pthread_mutex_unlock(&targ[i].wait); /* wake up */
- sigrelse(SIGCHLD);
+ signal_maskfunc(SIGCHLD, SIG_UNBLOCK);
pthread_mutex_lock(&mainwait);
- sighold(SIGCHLD);
+ signal_maskfunc(SIGCHLD, SIG_BLOCK);
}
@@ -847,7 +858,7 @@ main(int argc, char **argv)
/* set up sigchild signal handler */
signal(SIGCHLD, handler);
- sighold(SIGCHLD);
+ signal_maskfunc(SIGCHLD, SIG_BLOCK);
/* make children */
--
1.7.5.4
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c
2012-03-01 21:11 ` [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c Kamal Dasu
2012-03-01 21:11 ` [PATCH 2/2] xfsprogs: Use Posix signal API signprocmask instead of sigrelse/sighold in xfs_copy.c Kamal Dasu
@ 2012-03-02 7:45 ` Christoph Hellwig
2012-03-05 16:16 ` Kamal Dasu
1 sibling, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2012-03-02 7:45 UTC (permalink / raw)
To: Kamal Dasu; +Cc: xfs
On Thu, Mar 01, 2012 at 04:11:24PM -0500, Kamal Dasu wrote:
> >From the ustat man page
>
> NOTES
> ustat() is deprecated and has only been provided for compatibility.
> All new programs should use statfs(2) instead.
xfsprogs isn't new :)
More seriously - ustat provides the benefit to check if the block device
is mounted anywhere, which we make use of here. A statfs of the block
device path doesn't provide that functionality at all.
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c
2012-03-02 7:45 ` [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c Christoph Hellwig
@ 2012-03-05 16:16 ` Kamal Dasu
0 siblings, 0 replies; 5+ messages in thread
From: Kamal Dasu @ 2012-03-05 16:16 UTC (permalink / raw)
To: xfs; +Cc: Kevin Cernekee
Christoph,
> More seriously - ustat provides the benefit to check if the block device
> is mounted anywhere, which we make use of here. A statfs of the block
> device path doesn't provide that functionality at all.
>
Now I understand your concern. However if we would want to replace the
deprecated ustat call, then what other way would be acceptable to
achieve the same. Would parsing the /proc/mounts for the block device
name suffice ?.
Thanks
Kamal
On Fri, Mar 2, 2012 at 2:45 AM, Christoph Hellwig <hch@infradead.org> wrote:
> On Thu, Mar 01, 2012 at 04:11:24PM -0500, Kamal Dasu wrote:
>> >From the ustat man page
>>
>> NOTES
>> ustat() is deprecated and has only been provided for compatibility.
>> All new programs should use statfs(2) instead.
>
> xfsprogs isn't new :)
>
> More seriously - ustat provides the benefit to check if the block device
> is mounted anywhere, which we make use of here. A statfs of the block
> device path doesn't provide that functionality at all.
>
_______________________________________________
xfs mailing list
xfs@oss.sgi.com
http://oss.sgi.com/mailman/listinfo/xfs
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-03-05 16:16 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-01 21:11 [PATCH 0/2] xfsprogs: Replace deprecated ustat and sig(relse/hold) glibc APIs Kamal Dasu
2012-03-01 21:11 ` [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c Kamal Dasu
2012-03-01 21:11 ` [PATCH 2/2] xfsprogs: Use Posix signal API signprocmask instead of sigrelse/sighold in xfs_copy.c Kamal Dasu
2012-03-02 7:45 ` [PATCH 1/2] xfsprogs: replace deprecated ustat call with statfs in libxfs/linux.c Christoph Hellwig
2012-03-05 16:16 ` Kamal Dasu
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox