#include <string.h>
#include <lib/dmport.h>
+#include <lib/hsm.h>
#include <getopt.h>
#ifdef linux
char *name;
int opt;
- if (Progname = strrchr(argv[0], '/')) {
+ Progname = strrchr(argv[0], '/');
+ if (Progname) {
Progname++;
} else {
Progname = argv[0];
buflen, pathbufp, &rlenp)) {
if (errno == E2BIG) {
fprintf(stderr, "dm_handle_to_path buffer too small, "
- "should be %d bytes\n", rlenp);
+ "should be %zd bytes\n", rlenp);
} else {
fprintf(stderr, "dm_handle_to_path failed, (%d) %s\n",
errno, strerror(errno));
}
return(1);
}
- fprintf(stderr, "rlenp is %d, pathbufp is %s\n", rlenp, (char*)pathbufp);
+ fprintf(stderr, "rlenp is %zd, pathbufp is %s\n", rlenp, (char*)pathbufp);
if (strlen(pathbufp) + 1 != rlenp) {
- fprintf(stderr, "rlenp is %d, should be %d\n", rlenp,
+ fprintf(stderr, "rlenp is %zd, should be %zd\n", rlenp,
strlen(pathbufp) + 1);
return(1);
}
int argc,
char **argv)
{
- dm_sessid_t sid, oldsid, targetsid, *newsidp, *sidbufp;
- dm_token_t token, *tokenp, *rtokenp, *tokenbufp;
- dm_attrname_t *attrnamep;
- dm_off_t off, *offp, *roffp;
- dm_extent_t *extentp;
- dm_inherit_t *inheritbufp;
- dm_stat_t *statp;
- dm_size_t len, *dmrlenp, *retvalp;
- dm_attrloc_t *locp;
- dm_eventset_t *eventsetp;
- dm_config_t flagname;
- dm_region_t *regbufp;
- dm_response_t response;
- dm_right_t right, *rightp;
- dm_igen_t igen, *igenp;
- dm_msgtype_t msgtype;
- dm_fileattr_t *attrp;
- dm_boolean_t enable, *exactflagp;
- dm_timestruct_t *delay;
- mode_t mode;
- size_t hlen, dirhlen, hlen1, hlen2, targhlen, *fshlenp, *hlenp;
- size_t msglen, buflen, *rlenp;
- u_int nelem, mask, maxmsgs, uflags, *nelemp, maxevent;
- void *hanp, *dirhanp, *hanp1, *hanp2, *targhanp;
- void *msgdatap, *bufp, **hanpp, *respbufp, **fshanpp;
- dm_fsid_t fsid, *fsidp;
- dm_ino_t ino, *inop;
- char *cname, *sessinfop, *path, *pathbufp, **versionstrpp;
- int flags, fd, setdtime, reterror;
- u_int urc;
- int rc;
+ dm_sessid_t sid = 0, oldsid = 0, targetsid = 0;
+ dm_sessid_t *newsidp = NULL, *sidbufp = NULL;
+ dm_token_t token = 0, *tokenp = NULL;
+ dm_token_t *rtokenp = NULL, *tokenbufp = NULL;
+ dm_attrname_t *attrnamep = NULL;
+ dm_off_t off = 0, *offp = NULL, *roffp = NULL;
+ dm_extent_t *extentp = NULL;
+ dm_inherit_t *inheritbufp = NULL;
+ dm_stat_t *statp = NULL;
+ dm_size_t len = 0, *dmrlenp = NULL, *retvalp = NULL;
+ dm_attrloc_t *locp = NULL;
+ dm_eventset_t *eventsetp = NULL;
+ dm_config_t flagname = DM_CONFIG_INVALID;
+ dm_region_t *regbufp = NULL;
+ dm_response_t response = DM_RESP_INVALID;
+ dm_right_t right = DM_RIGHT_NULL, *rightp = NULL;
+ dm_igen_t igen, *igenp = NULL;
+ dm_msgtype_t msgtype = DM_MSGTYPE_INVALID;
+ dm_fileattr_t *attrp = NULL;
+ dm_boolean_t enable = 0, *exactflagp = NULL;
+ dm_timestruct_t *delay = NULL;
+ mode_t mode = 0;
+ size_t hlen = 0, dirhlen = 0, hlen1 = 0, hlen2 = 0;
+ size_t targhlen = 0, *fshlenp = NULL, *hlenp = NULL;
+ size_t msglen = 0, buflen = 0, *rlenp = NULL;
+ u_int nelem = 0, mask = 0, maxmsgs = 0, uflags = 0;
+ u_int *nelemp = NULL, maxevent = 0;
+ void *hanp = NULL, *dirhanp = NULL;
+ void *hanp1 = NULL, *hanp2 = NULL, *targhanp = NULL;
+ void *msgdatap = NULL, *bufp = NULL, **hanpp = NULL;
+ void *respbufp = NULL, **fshanpp = NULL;
+ dm_fsid_t fsid, *fsidp = NULL;
+ dm_ino_t ino, *inop = NULL;
+ char *cname = NULL, *sessinfop = NULL;
+ char *path = NULL, *pathbufp = NULL, **versionstrpp = NULL;
+ int flags = 0, fd = 0, setdtime = 0, reterror = 0;
+ u_int urc;
+ int rc;
dm_ssize_t ssrc;
/* Definitions per the prototypes in dmport.h, in the same order. */
for (i = 0; i < 200; i += 2) {
offset = i * 65536;
if (lseek(fd, offset, SEEK_SET) < 0) {
- fprintf(stderr, "seek to %d failed, %s\n", offset,
+ fprintf(stderr, "seek to %zd failed, %s\n", offset,
strerror(errno));
exit(1);
}
if ((count = write(fd, buf, buflen)) < 0) {
fprintf(stderr, "write of %d bytes failed at offset "
- "%d, , %s\n", buflen, offset, strerror(errno));
+ "%zd, , %s\n", buflen, offset, strerror(errno));
exit(1);
}
if (count != buflen) {
fprintf(stderr, "expected to write %d bytes at offset "
- "%d, actually wrote %d\n", buflen, offset,
+ "%zd, actually wrote %zd\n", buflen, offset,
count);
exit(1);
}