zlook.c revision 6a45aeb4299937971b2d4ebd68553ee5a39fe913
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*/
/*
* This is a test program that uses ioctls to the ZFS Unit Test driver
* to perform readdirs or lookups using flags not normally available
* to user-land programs. This allows testing of the flags'
* behavior outside of a complicated consumer, such as the SMB driver.
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <stropts.h>
#include <errno.h>
#include <stddef.h>
#include <fcntl.h>
#include <string.h>
#include <time.h>
#define _KERNEL
#include <sys/extdirent.h>
#define BIGBUF 4096
#define DIRENT_NAMELEN(reclen) \
static void
{
"file-in-dir [xfile-on-file]\n", pnam);
"file-in-dir [xfile-on-file]\n", pnam);
"file-in-dir [xfile-on-file]\n", pnam);
"dir-to-look-in [file-in-dir]\n", pnam);
"dir-to-look-in [file-in-dir]\n", pnam);
"dir-to-look-in [file-in-dir]\n", pnam);
"for path with pathconf(2)\n");
"for path with pathconf(2)\n");
"for path with pathconf(2)\n");
}
static void
{
char *bufstart;
char *blanks = " ";
int i = 0;
break;
}
if (i < 16)
}
}
static void
{
dirent64_t *dp;
char *bufstart;
int i = 0;
break;
}
(void) printf("\n");
}
}
static void
{
char timebuf[512];
timebuf[0] = 0;
(void) printf("st_atime\t\t");
}
timebuf[0] = 0;
(void) printf("st_mtime\t\t");
}
timebuf[0] = 0;
(void) printf("st_ctime\t\t");
}
}
static void
{
int idx = 0;
if (xvs == 0)
return;
(void) printf("-------------------\n");
(void) printf("Attribute bit(s) set:\n");
(void) printf("-------------------\n");
while (bits) {
if (bits & 1) {
if (rest)
(void) printf(", ");
}
idx++;
}
(void) printf("\n");
}
int
{
zut_lookup_t lk = {0};
zut_readdir_t rd = {0};
long rddir_bufsize = BIGBUF;
int error = 0;
int check;
int fd;
int c;
switch (c) {
case 'l':
break;
case 'i':
break;
case 's':
break;
case 'a':
break;
case 'e':
break;
case 'r':
break;
case 'b':
break;
case 'A':
break;
case 'S':
break;
case 'E':
break;
case '?':
default:
}
}
"must be >= %d and less than or equal to %d bytes.\n",
}
if (checking) {
char pathbuf[MAXPATHLEN];
long result;
switch (check) {
case _PC_SATTR_ENABLED:
(void) printf("System attributes ");
if (result != 0)
(void) printf("Enabled\n");
else
(void) printf("Not enabled\n");
break;
case _PC_SATTR_EXISTS:
(void) printf("System attributes ");
if (result != 0)
(void) printf("Exist\n");
else
(void) printf("Do not exist\n");
break;
case _PC_ACCESS_FILTERING:
(void) printf("Access filtering ");
if (result != 0)
(void) printf("Available\n");
else
(void) printf("Not available\n");
break;
}
return (result);
}
return (ENXIO);
}
if (reading) {
char *buf;
}
perror("malloc");
return (error);
}
int ierr;
"IOCTL error: %s (%d)\n",
return (ierr);
}
if (rd.zr_retcode) {
"readdir result: %s (%d)\n",
return (rd.zr_retcode);
}
else
print_entries(&rd);
}
} else {
int ierr;
}
"IOCTL error: %s (%d)\n",
return (ierr);
}
(void) printf("\nLookup of ");
(void) printf("extended attribute \"%s\" of ",
}
if (lk.zl_retcode) {
(void) printf("failed: %s (%d)\n",
return (lk.zl_retcode);
}
(void) printf("succeeded.\n");
(void) printf("----------------------------\n");
}
(void) printf("----------------------------\n");
}
}
return (0);
}