From: Amir Goldstein <amir73il@gmail.com>
To: Eryu Guan <eguan@redhat.com>
Cc: Trond Myklebust <trondmy@primarydata.com>,
Jeff Layton <jlayton@poochiereds.net>,
"J . Bruce Fields" <bfields@fieldses.org>,
David Howells <dhowells@redhat.com>,
Miklos Szeredi <miklos@szeredi.hu>,
fstests@vger.kernel.org, linux-unionfs@vger.kernel.org
Subject: [PATCH v2 1/4] fstests: remove IRIX test program open_unlink
Date: Wed, 19 Apr 2017 19:29:16 +0300 [thread overview]
Message-ID: <1492619359-24763-2-git-send-email-amir73il@gmail.com> (raw)
In-Reply-To: <1492619359-24763-1-git-send-email-amir73il@gmail.com>
It does not seem to be used by any test.
Signed-off-by: Amir Goldstein <amir73il@gmail.com>
---
src/Makefile | 3 --
src/open_unlink.c | 147 ------------------------------------------------------
2 files changed, 150 deletions(-)
delete mode 100644 src/open_unlink.c
diff --git a/src/Makefile b/src/Makefile
index e62d7a9..247383c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -40,14 +40,11 @@ ifeq ($(HAVE_FALLOCATE), true)
LCFLAGS += -DHAVE_FALLOCATE
endif
-IRIX_TARGETS = open_unlink
-
ifeq ($(PKG_PLATFORM),linux)
TARGETS += $(LINUX_TARGETS)
endif
ifeq ($(PKG_PLATFORM),irix)
-TARGETS += $(IRIX_TARGETS)
LLDLIBS += -lgen
endif
diff --git a/src/open_unlink.c b/src/open_unlink.c
deleted file mode 100644
index 9f83929..0000000
--- a/src/open_unlink.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2005 Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it would be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-#include <stdlib.h>
-#include <stdio.h>
-#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/attributes.h>
-#include <sys/fs/xfs_itable.h>
-
-#ifndef ATTR_PARENT
-#define ATTR_PARENT 0x0040
-#endif
-
-#define EA_LISTBUF_SZ 16384
-
-int
-main(int argc, char *argv[])
-{
- char *path;
- int fd;
- char *prog = argv[0];
- void *handle;
- size_t hlen;
- attrlist_cursor_t cursor;
- attrlist_t *ea_listbuf = (attrlist_t *)malloc(EA_LISTBUF_SZ);
- uint64_t parent_ino;
- uint64_t link_cnt;
- int sts;
- int nameix;
- attrlist_ent_t *entp;
-
- if (argc < 2) {
- fprintf(stderr, "%s: missing pathname argument\n", prog);
- return 1;
- }
- path = argv[1];
-
- if (argc > 2) {
- fprintf(stderr, "%s: too many arguments\n", prog);
- return 1;
- }
-
- /* if file already exists then error out */
- if (access(path, F_OK) == 0) {
- fprintf(stderr, "%s: file \"%s\" already exists\n", prog, path);
- return 1;
- }
-
- fd = open(path, O_RDWR|O_CREAT|O_EXCL);
- if (fd == -1) {
- fprintf(stderr, "%s: failed to create \"%s\": %s\n", prog, path, strerror(errno));
- return 1;
- }
-
-
- /* for linux libhandle version - to set libhandle fsfd cache */
- {
- void *fshandle;
- size_t fshlen;
-
- if (path_to_fshandle(path, &fshandle, &fshlen) != 0) {
- fprintf(stderr, "%s: failed path_to_fshandle \"%s\": %s\n",
- prog, path, strerror(errno));
- return 1;
- }
- }
-
-
- /*
- * look at parentptr EAs and see if the path exists now that
- * it has been unlinked.
- */
- if (fd_to_handle(fd, &handle, &hlen) != 0) {
- fprintf(stderr, "%s: failed to fd_to_handle \"%s\": %s\n",
- prog, path, strerror(errno));
- return 1;
- }
-
- if (unlink(path) == -1) {
- fprintf(stderr, "%s: failed to unlink \"%s\": %s\n", prog, path, strerror(errno));
- return 1;
- }
-
- memset(&cursor, 0, sizeof(cursor));
-
- /* just do one call - don't bother with continue logic */
- sts = attr_list_by_handle(handle,
- hlen,
- (char*)ea_listbuf,
- EA_LISTBUF_SZ,
- ATTR_PARENT,
- &cursor);
- if (sts != 0) {
- fprintf(stderr, "%s: failed to list attr for \"%s\": %s\n", prog, path, strerror(errno));
- return 1;
- }
-
- printf("ea count = %d\n", ea_listbuf->al_count);
-
- /*
- * process EA list
- */
- for (nameix = 0; nameix < ea_listbuf->al_count; nameix++) {
- entp = ATTR_ENTRY(ea_listbuf, nameix);
-
- sts = sscanf(entp->a_name, "%llx %llx", &parent_ino, &link_cnt);
- if (sts != 2) {
- fprintf(stderr,
- "inode-path for \"%s\" is corrupted\n",
- path);
-
- /* go onto next EA name */
- continue;
- }
- /* just print the info out */
- printf("[%d] parent_ino = %llu, link_cnt = %llu\n", nameix, parent_ino, link_cnt);
- }
-
-
- free_handle(handle, hlen);
-
- if (close(fd) == -1) {
- fprintf(stderr, "%s: failed to close \"%s\": %s\n", prog, path, strerror(errno));
- return 1;
- }
-
- return 0;
-}
--
2.7.4
next prev parent reply other threads:[~2017-04-19 16:29 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-19 16:29 [PATCH v2 0/4] fstests: generic test for NFS handles Amir Goldstein
2017-04-19 16:29 ` Amir Goldstein [this message]
2017-04-19 16:29 ` [PATCH v2 2/4] src/open_by_handle: program to exercise open_by_handle_at() syscall Amir Goldstein
2017-04-22 7:55 ` Rock Lee
2017-04-19 16:29 ` [PATCH v2 3/4] src/open_by_handle: flexible usage options Amir Goldstein
2017-04-19 16:29 ` [PATCH v2 4/4] fstests: add generic test for file handles Amir Goldstein
2017-04-20 6:00 ` Eryu Guan
2017-04-20 6:34 ` Amir Goldstein
2017-04-20 7:21 ` Eryu Guan
2017-04-20 8:03 ` Amir Goldstein
2017-04-20 8:09 ` [PATCH v3 " Amir Goldstein
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1492619359-24763-2-git-send-email-amir73il@gmail.com \
--to=amir73il@gmail.com \
--cc=bfields@fieldses.org \
--cc=dhowells@redhat.com \
--cc=eguan@redhat.com \
--cc=fstests@vger.kernel.org \
--cc=jlayton@poochiereds.net \
--cc=linux-unionfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=trondmy@primarydata.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox