One wouldn't believe how many of them are in the code ...
}
if (dm_prereq(DM_TARGET, 0, 0, 0) && (what == ADD || what == DELETE)) {
- fprintf(stderr, "device mapper prerequisites not met\n");
+ fprintf(stderr, "device mapper prerequisites not met\n");
exit(1);
}
break;
case ADD:
- for (j=0, c = 0; j<n; j++) {
+ for (j = 0, c = 0; j < n; j++) {
if (slices[j].size == 0)
continue;
sigset_t set, oldset;
struct flock lock;
int err;
-
+
memset(&lock, 0, sizeof(lock));
lock.l_type = F_WRLCK;
lock.l_whence = SEEK_SET;
}
if (*can_write && lock_bindings_file(fd) < 0)
goto fail;
-
+
memset(&s, 0, sizeof(s));
if (fstat(fd, &s) < 0){
condlog(0, "Cannot stat bindings file : %s", strerror(errno));
fsync(fd);
condlog(3, "Initialized new bindings file [%s]", file);
}
-
+
return fd;
fail:
store_ble (vector blist, char * str, int origin)
{
struct blentry * ble;
-
+
if (!str)
return 0;
vector_set_slot(blist, ble);
return 0;
}
-
+
extern int
set_ble_device (vector blist, char * vendor, char * product, int origin)
{
struct blentry_device * ble;
-
+
if (!blist)
return 1;
int
_blacklist_exceptions (vector elist, char * str)
{
- int i;
- struct blentry * ele;
+ int i;
+ struct blentry * ele;
- vector_foreach_slot (elist, ele, i) {
- if (!regexec(&ele->regex, str, 0, NULL, 0))
+ vector_foreach_slot (elist, ele, i) {
+ if (!regexec(&ele->regex, str, 0, NULL, 0))
return 1;
}
- return 0;
+ return 0;
}
int
}
#define LOG_BLIST(M) \
- if (vendor && product) \
+ if (vendor && product) \
condlog(3, "%s: (%s:%s) %s", dev, vendor, product, (M)); \
- else if (wwid) \
- condlog(3, "%s: (%s) %s", dev, wwid, (M)); \
- else \
+ else if (wwid) \
+ condlog(3, "%s: (%s) %s", dev, wwid, (M)); \
+ else \
condlog(3, "%s: %s", dev, (M))
void
if (r > 0)
return r;
r = _filter_device(conf->blist_device, conf->elist_device,
- pp->vendor_id, pp->product_id);
+ pp->vendor_id, pp->product_id);
if (r > 0)
return r;
r = _filter_wwid(conf->blist_wwid, conf->elist_wwid, pp->wwid);
if (find_hwe_strmatch(hwtable, dhwe))
return 0;
-
+
if (!(hwe = alloc_hwe()))
return 1;
if (!dhwe->vendor || !(hwe->vendor = set_param_str(dhwe->vendor)))
goto out;
-
+
if (!dhwe->product || !(hwe->product = set_param_str(dhwe->product)))
goto out;
-
+
if (dhwe->revision && !(hwe->revision = set_param_str(dhwe->revision)))
goto out;
-
+
if (dhwe->getuid && !(hwe->getuid = set_param_str(dhwe->getuid)))
goto out;
if (dhwe->features && !(hwe->features = set_param_str(dhwe->features)))
goto out;
-
+
if (dhwe->hwhandler && !(hwe->hwhandler = set_param_str(dhwe->hwhandler)))
goto out;
if (conf->mptable == NULL) {
conf->mptable = vector_alloc();
-
if (!conf->mptable)
goto out;
}
goto out;
dm_task_no_open_count(dmt);
- dm_task_skip_lockfs(dmt); /* for DM_DEVICE_RESUME */
+ dm_task_skip_lockfs(dmt); /* for DM_DEVICE_RESUME */
#ifdef LIBDM_API_FLUSH
- dm_task_no_flush(dmt); /* for DM_DEVICE_SUSPEND/RESUME */
+ dm_task_no_flush(dmt); /* for DM_DEVICE_SUSPEND/RESUME */
#endif
r = dm_task_run (dmt);
if (!dmt)
return 1;
- if (!dm_task_set_name (dmt, name))
- goto uuidout;
+ if (!dm_task_set_name (dmt, name))
+ goto uuidout;
if (!dm_task_run(dmt))
- goto uuidout;
+ goto uuidout;
uuidtmp = dm_task_get_uuid(dmt);
if (uuidtmp) {
dm_task_destroy(dmt);
return r;
}
-
+
int
dm_get_opencount (const char * mapname)
{
dm_task_destroy(dmt);
return r;
}
-
+
int
dm_get_minor (char * mapname)
{
dm_task_destroy(dmt);
return r;
}
-
+
extern int
dm_flush_map (const char * mapname)
{
if (dm_get_opencount(mapname)) {
condlog(2, "%s: map in use", mapname);
return 1;
- }
+ }
r = dm_simplecmd(DM_DEVICE_REMOVE, mapname);
vector_set_slot(mp, mpp);
mpp = NULL;
next:
- next = names->next;
- names = (void *) names + next;
+ next = names->next;
+ names = (void *) names + next;
} while (next);
r = 0;
*/
strstr(params, dev_t)
) {
- /*
+ /*
* then it's a kpartx generated partition.
* remove it.
*/
{
int r = 1;
struct dm_task *dmt = NULL;
-
+
if (!mapname)
return 1;
*/
strstr(buff, dev_t)
) {
- /*
+ /*
* then it's a kpartx generated partition.
* Rename it.
*/
if (!dm_task_set_newname(dmt, new))
goto out;
-
+
dm_task_no_open_count(dmt);
if (!dm_task_run(dmt))
if (!conf->getuid)
return 1;
-
+
return 0;
}
static int
ble_except_wwid_handler(vector strvec)
{
- char * buff;
+ char * buff;
- buff = set_value(strvec);
+ buff = set_value(strvec);
- if (!buff)
- return 1;
+ if (!buff)
+ return 1;
return store_ble(conf->elist_wwid, buff, ORIGIN_CONFIG);
}
if (!hwe)
return 1;
-
+
hwe->vendor = set_value(strvec);
if (!hwe->vendor)
if (!hwe)
return 1;
-
+
hwe->product = set_value(strvec);
if (!hwe->product)
hw_selector_handler(vector strvec)
{
struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable);
-
+
if (!hwe)
return 1;
hw_features_handler(vector strvec)
{
struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable);
-
+
if (!hwe)
return 1;
hw_handler_handler(vector strvec)
{
struct hwentry * hwe = VECTOR_LAST_SLOT(conf->hwtable);
-
+
if (!hwe)
return 1;
if (!mpe)
return 1;
- mpe->alias = set_value(strvec);
+ mpe->alias = set_value(strvec);
if (!mpe->alias)
return 1;
mp_selector_handler(vector strvec)
{
struct mpentry * mpe = VECTOR_LAST_SLOT(conf->mptable);
-
+
if (!mpe)
return 1;
if (!mpe->pgpolicy)
return 0;
get_pgpolicy_name(str, POLICY_NAME_SIZE, mpe->pgpolicy);
-
+
return snprintf(buff, len, "%s", str);
}
return 0;
get_pgpolicy_name(str, POLICY_NAME_SIZE, hwe->pgpolicy);
-
+
return snprintf(buff, len, "%s", str);
}
return 0;
get_pgpolicy_name(str, POLICY_NAME_SIZE, conf->pgpolicy);
-
+
return snprintf(buff, len, "%s", str);
}
return 0;
if (conf->max_fds < 0)
- return snprintf(buff, len, "unlimited");
+ return snprintf(buff, len, "unlimited");
return snprintf(buff, len, "%d", conf->max_fds);
}
return snprintf(buff, len, "\"%s\"", bled->vendor);
}
-
+
static int
snprint_bled_product (char * buff, int len, void * data)
{
return snprintf(buff, len, "\"%s\"", bled->product);
}
-
+
#define __deprecated
void
condlog(0, "path too small");
return 1;
}
-
+
if (strncmp(devname,"cciss",5) && !filepresent(path)) {
condlog(4, "path %s not present", path);
return 0;
return 0;
}
-
+
int
sysfs_get_fc_nodename (struct sysfs_device * dev, char * node,
unsigned int host, unsigned int channel,
{
char attr_path[SYSFS_PATH_SIZE], *attr;
- if (safe_sprintf(attr_path,
+ if (safe_sprintf(attr_path,
"/class/fc_transport/target%i:%i:%i",
host, channel, target)) {
condlog(0, "attr_path too small");
return 1;
}
-
-/*
- * udev might be slow creating node files : wait
- */
+
static int
opennode (char * dev, int mode)
{
condlog(0, "Cannot open /proc/partitions");
return 1;
}
-
+
while (!feof(fd)) {
int r = fscanf(fd,"%u %u %*d %s",&tmpmaj, &tmpmin, dev);
if (!r) {
- fscanf(fd,"%*s\n");
+ r = fscanf(fd,"%*s\n");
continue;
}
if (r != 3)
do_inq(int sg_fd, int cmddt, int evpd, unsigned int pg_op,
void *resp, int mx_resp_len, int noisy)
{
- unsigned char inqCmdBlk[INQUIRY_CMDLEN] =
- { INQUIRY_CMD, 0, 0, 0, 0, 0 };
- unsigned char sense_b[SENSE_BUFF_LEN];
- struct sg_io_hdr io_hdr;
-
- if (cmddt)
- inqCmdBlk[1] |= 2;
- if (evpd)
- inqCmdBlk[1] |= 1;
- inqCmdBlk[2] = (unsigned char) pg_op;
+ unsigned char inqCmdBlk[INQUIRY_CMDLEN] =
+ { INQUIRY_CMD, 0, 0, 0, 0, 0 };
+ unsigned char sense_b[SENSE_BUFF_LEN];
+ struct sg_io_hdr io_hdr;
+
+ if (cmddt)
+ inqCmdBlk[1] |= 2;
+ if (evpd)
+ inqCmdBlk[1] |= 1;
+ inqCmdBlk[2] = (unsigned char) pg_op;
inqCmdBlk[3] = (unsigned char)((mx_resp_len >> 8) & 0xff);
inqCmdBlk[4] = (unsigned char) (mx_resp_len & 0xff);
- memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
- io_hdr.interface_id = 'S';
- io_hdr.cmd_len = sizeof (inqCmdBlk);
- io_hdr.mx_sb_len = sizeof (sense_b);
- io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
- io_hdr.dxfer_len = mx_resp_len;
- io_hdr.dxferp = resp;
- io_hdr.cmdp = inqCmdBlk;
- io_hdr.sbp = sense_b;
- io_hdr.timeout = DEF_TIMEOUT;
-
- if (ioctl(sg_fd, SG_IO, &io_hdr) < 0)
- return -1;
-
- /* treat SG_ERR here to get rid of sg_err.[ch] */
- io_hdr.status &= 0x7e;
- if ((0 == io_hdr.status) && (0 == io_hdr.host_status) &&
- (0 == io_hdr.driver_status))
- return 0;
- if ((SCSI_CHECK_CONDITION == io_hdr.status) ||
- (SCSI_COMMAND_TERMINATED == io_hdr.status) ||
- (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) {
- if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) {
- int sense_key;
- unsigned char * sense_buffer = io_hdr.sbp;
- if (sense_buffer[0] & 0x2)
- sense_key = sense_buffer[1] & 0xf;
- else
- sense_key = sense_buffer[2] & 0xf;
- if(RECOVERED_ERROR == sense_key)
- return 0;
- }
- }
- return -1;
+ memset(&io_hdr, 0, sizeof (struct sg_io_hdr));
+ io_hdr.interface_id = 'S';
+ io_hdr.cmd_len = sizeof (inqCmdBlk);
+ io_hdr.mx_sb_len = sizeof (sense_b);
+ io_hdr.dxfer_direction = SG_DXFER_FROM_DEV;
+ io_hdr.dxfer_len = mx_resp_len;
+ io_hdr.dxferp = resp;
+ io_hdr.cmdp = inqCmdBlk;
+ io_hdr.sbp = sense_b;
+ io_hdr.timeout = DEF_TIMEOUT;
+
+ if (ioctl(sg_fd, SG_IO, &io_hdr) < 0)
+ return -1;
+
+ /* treat SG_ERR here to get rid of sg_err.[ch] */
+ io_hdr.status &= 0x7e;
+ if ((0 == io_hdr.status) && (0 == io_hdr.host_status) &&
+ (0 == io_hdr.driver_status))
+ return 0;
+ if ((SCSI_CHECK_CONDITION == io_hdr.status) ||
+ (SCSI_COMMAND_TERMINATED == io_hdr.status) ||
+ (SG_ERR_DRIVER_SENSE == (0xf & io_hdr.driver_status))) {
+ if (io_hdr.sbp && (io_hdr.sb_len_wr > 2)) {
+ int sense_key;
+ unsigned char * sense_buffer = io_hdr.sbp;
+ if (sense_buffer[0] & 0x2)
+ sense_key = sense_buffer[1] & 0xf;
+ else
+ sense_key = sense_buffer[2] & 0xf;
+ if(RECOVERED_ERROR == sense_key)
+ return 0;
+ }
+ }
+ return -1;
}
static int
get_serial (char * str, int maxlen, int fd)
{
- int len = 0;
- char buff[MX_ALLOC_LEN + 1] = {0};
+ int len = 0;
+ char buff[MX_ALLOC_LEN + 1] = {0};
if (fd < 0)
- return 1;
+ return 1;
if (0 == do_inq(fd, 0, 1, 0x80, buff, MX_ALLOC_LEN, 0)) {
len = buff[3];
}
return 0;
}
- return 1;
+ return 1;
}
static int
/*
* host / bus / target / lun
- */
+ */
basename(parent->devpath, attr_path);
pp->sg_id.lun = 0;
sscanf(attr_path, "%i.%i.%x",
static void dump_logarea (void)
{
struct logmsg * msg;
-
+
logdbg(stderr, "\n==== area: start addr = %p, end addr = %p ====\n",
la->start, la->end);
logdbg(stderr, "|addr |next |prio|msg\n");
logdbg(stderr, "\n\n");
}
#endif
-
+
static int logarea_init (int size)
{
logdbg(stderr,"enter logarea_init\n");
la = (struct logarea *)MALLOC(sizeof(struct logarea));
-
+
if (!la)
return 1;
lastmsg = (struct logmsg *)la->tail;
if (!la->empty) {
- fwd = sizeof(struct logmsg) +
+ fwd = sizeof(struct logmsg) +
strlen((char *)&lastmsg->str) * sizeof(char) + 1;
la->tail += ALIGN(fwd, sizeof(void *));
}
/* not enough space on tail : rewind */
if (la->head <= la->tail && len > (la->end - la->tail)) {
logdbg(stderr, "enqueue: rewind tail to %p\n", la->tail);
- if (la->head == la->start ) {
- logdbg(stderr, "enqueue: can not rewind tail, drop msg\n");
- la->tail = lastmsg;
- return 1; /* can't reuse */
- }
+ if (la->head == la->start ) {
+ logdbg(stderr, "enqueue: can not rewind tail, drop msg\n");
+ la->tail = lastmsg;
+ return 1; /* can't reuse */
+ }
la->tail = la->start;
if (la->empty)
void log_thread_start (void)
{
pthread_attr_t attr;
-
+
logdbg(stderr,"enter log_thread_start\n");
logq_lock = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
logev_lock = (pthread_mutex_t *) malloc(sizeof(pthread_mutex_t));
logev_cond = (pthread_cond_t *) malloc(sizeof(pthread_cond_t));
-
+
pthread_mutex_init(logq_lock, NULL);
pthread_mutex_init(logev_lock, NULL);
pthread_cond_init(logev_cond, NULL);
-
+
pthread_attr_init(&attr);
pthread_attr_setstacksize(&attr, 64 * 1024);
pthread_cond_destroy(logev_cond);
free_logarea();
-}
+}
-/*
+/*
* Part: Configuration file parser/reader. Place into the dynamic
* data structure representation the conf file
- *
+ *
* Version: $Id: parser.c,v 1.0.3 2003/05/11 02:28:03 acassen Exp $
- *
+ *
* Author: Alexandre Cassen, <acassen@linux-vs.org>
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
if (!keyword)
return 1;
-
+
if (!vector_alloc_slot(keywords)) {
FREE(keyword);
return 1;
break;
}
}
-
+
free_strvec(strvec);
}
struct path * pp;
struct pathgroup * pgp;
struct path * pp2;
-
+
if (!mp->pg)
mp->pg = vector_alloc();
bitmap[i] = 1;
for (j = i + 1; j < VECTOR_SIZE(mp->paths); j++) {
-
+
if (bitmap[j])
continue;
pp2 = VECTOR_SLOT(mp->paths, j);
-
+
if (!strncmp(pp->tgt_node_name, pp2->tgt_node_name,
NODE_NAME_SIZE)) {
if (store_path(pgp->paths, pp2))
struct path * pp;
struct pathgroup * pgp;
struct path * pp2;
-
+
if (!mp->pg)
mp->pg = vector_alloc();
/* feed the first path */
if (store_path(pgp->paths, pp))
goto out1;
-
+
bitmap[i] = 1;
for (j = i + 1; j < VECTOR_SIZE(mp->paths); j++) {
-
+
if (bitmap[j])
continue;
pp2 = VECTOR_SLOT(mp->paths, j);
-
+
if (0 == strcmp(pp->serial, pp2->serial)) {
if (store_path(pgp->paths, pp2))
goto out1;
if (!mp->pg)
mp->pg = vector_alloc();
-
+
if (!mp->pg)
return 1;
if (store_pathgroup(mp->pg, pgp))
goto out;
-
+
if (store_path(pgp->paths, pp))
goto out;
}
return 1;
pgp = alloc_pathgroup();
-
+
if (!pgp)
goto out;
-
+
vector_free(pgp->paths);
pgp->paths = mp->paths;
mp->paths = NULL;
if (!pgp)
goto out;
-
+
if (store_path(pgp->paths, VECTOR_SLOT(mp->paths, 0)))
goto out;
#define PAD(x) while ((int)(c - s) < (x) && (c < (line + len - 1))) \
*c++ = ' '; s = c
#define PRINT(var, size, format, args...) \
- fwd = snprintf(var, size, format, ##args); \
+ fwd = snprintf(var, size, format, ##args); \
c += (fwd >= size) ? size : fwd;
/*
char fmt[6] = {};
char units[] = {'K','M','G','T','P'};
char *u = units;
-
+
while (s >= 1024 && *u != 'P') {
s = s / 1024;
u++;
int j = PROGRESS_LEN - i;
char * c = buff;
char * end = buff + len;
-
+
while (i-- > 0) {
c += snprintf(c, len, "X");
if ((len = (end - c)) <= 1) goto out;
buff[c - buff + 1] = '\0';
return (c - buff + 1);
}
-
+
static int
snprint_failback (char * buff, size_t len, struct multipath * mpp)
{
if (!pp)
return 0;
return snprintf(buff, len, "%s,%s",
- pp->vendor_id, pp->product_id);
+ pp->vendor_id, pp->product_id);
}
static int
snprint_vpr (char * buff, size_t len, struct path * pp)
{
return snprintf(buff, len, "%s,%s",
- pp->vendor_id, pp->product_id);
+ pp->vendor_id, pp->product_id);
}
static int
continue;
}
f++;
-
+
if (!(data = mpd_lookup(*f)))
break; /* unknown wildcard */
-
+
PRINT(c, TAIL, data->header);
PAD(data->width);
} while (*f++);
continue;
}
f++;
-
+
if (!(data = mpd_lookup(*f)))
break;
-
+
data->snprint(buff, MAX_FIELD_LEN, mpp);
PRINT(c, TAIL, buff);
PAD(data->width);
continue;
}
f++;
-
+
if (!(data = pd_lookup(*f)))
break; /* unknown wildcard */
-
+
PRINT(c, TAIL, data->header);
PAD(data->width);
} while (*f++);
continue;
}
f++;
-
+
if (!(data = pd_lookup(*f)))
break;
-
+
data->snprint(buff, MAX_FIELD_LEN, pp);
PRINT(c, TAIL, buff);
PAD(data->width);
continue;
}
f++;
-
+
if (!(data = pgd_lookup(*f)))
break;
-
+
data->snprint(buff, MAX_FIELD_LEN, pgp);
PRINT(c, TAIL, buff);
PAD(data->width);
c += sprintf(c, "%%A: ");
c += sprintf(c, "%%n");
-
+
if (strncmp(mpp->alias, mpp->wwid, WWID_SIZE))
c += sprintf(c, " (%%w)");
if (fwd > len)
return len;
iterate_sub_keywords(rootkw, kw, i) {
- fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k %v\n",
+ fwd += snprint_keyword(buff + fwd, len - fwd, "\t\t%k \"%v\"\n",
kw, hwe);
if (fwd > len)
return len;
if (fwd > len)
return len;
return fwd;
-
}
static int
if ((len - fwd - threshold) <= 0)
return len;
fwd += snprintf(buff + fwd, len - fwd, "device node rules:\n"
- "- blacklist:\n");
+ "- blacklist:\n");
if (!snprint_blacklist_group(buff, len, &fwd, &conf->blist_devnode))
return len;
if ((len - fwd - threshold) <= 0)
return len;
fwd += snprintf(buff + fwd, len - fwd, "wwid rules:\n"
- "- blacklist:\n");
+ "- blacklist:\n");
if (snprint_blacklist_group(buff, len, &fwd, &conf->blist_wwid) == 0)
return len;
if ((len - fwd - threshold) <= 0)
return len;
fwd += snprintf(buff + fwd, len - fwd, "device rules:\n"
- "- blacklist:\n");
+ "- blacklist:\n");
if (snprint_blacklist_devgroup(buff, len, &fwd, &conf->blist_device) == 0)
return len;
fprintf(stdout, "===== no paths =====\n");
return;
}
-
+
if (banner)
fprintf(stdout, "===== paths list =====\n");
"more than one entry with same port "
"group.\n");
} else {
- PRINT_DEBUG("pref=%i\n", dscr->pref);
+ PRINT_DEBUG("pref=%i\n", dscr->b0);
rc = rtpg_tpg_dscr_get_aas(dscr);
}
}
/* True if `size1' is non-NULL and PTR is pointing anywhere inside
`string1' or just past its end. This works if PTR is NULL, which is
a good thing. */
-#define FIRST_STRING_P(ptr) \
+#define FIRST_STRING_P(ptr) \
(size1 && string1 <= (ptr) && (ptr) <= string1 + size1)
/* (Re)Allocate N items of type T using malloc, or fail. */
#define EXTRACT_NUMBER_AND_INCR(destination, source) \
do { \
EXTRACT_NUMBER (destination, source); \
- (source) += 2; \
+ (source) += 2; \
} while (0)
#undef assert
#define PATFETCH(c) \
do {if (p == pend) return REG_EEND; \
c = (unsigned char) *p++; \
- if (translate) c = translate[c]; \
+ if (translate) c = translate[c]; \
} while (0)
/* Fetch the next character in the uncompiled pattern, with no
translation. */
#define PATFETCH_RAW(c) \
do {if (p == pend) return REG_EEND; \
- c = (unsigned char) *p++; \
+ c = (unsigned char) *p++; \
} while (0)
/* Go backwards one character in the pattern. */
correct places in the new one. If extending the buffer results in it
being larger than MAX_BUF_SIZE, then flag memory exhausted. */
#define EXTEND_BUFFER() \
- do { \
+ do { \
unsigned char *old_buffer = bufp->buffer; \
- if (bufp->allocated == MAX_BUF_SIZE) \
+ if (bufp->allocated == MAX_BUF_SIZE) \
return REG_ESIZE; \
bufp->allocated <<= 1; \
if (bufp->allocated > MAX_BUF_SIZE) \
- bufp->allocated = MAX_BUF_SIZE; \
+ bufp->allocated = MAX_BUF_SIZE; \
bufp->buffer = (unsigned char *) REALLOC(bufp->buffer, bufp->allocated);\
if (bufp->buffer == NULL) \
return REG_ESPACE; \
/* If the buffer moved, move all the pointers into it. */ \
if (old_buffer != bufp->buffer) \
{ \
- b = (b - old_buffer) + bufp->buffer; \
- begalt = (begalt - old_buffer) + bufp->buffer; \
- if (fixup_alt_jump) \
- fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
- if (laststart) \
- laststart = (laststart - old_buffer) + bufp->buffer; \
- if (pending_exact) \
- pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
+ b = (b - old_buffer) + bufp->buffer; \
+ begalt = (begalt - old_buffer) + bufp->buffer; \
+ if (fixup_alt_jump) \
+ fixup_alt_jump = (fixup_alt_jump - old_buffer) + bufp->buffer;\
+ if (laststart) \
+ laststart = (laststart - old_buffer) + bufp->buffer; \
+ if (pending_exact) \
+ pending_exact = (pending_exact - old_buffer) + bufp->buffer; \
} \
} while (0)
/* Get the next unsigned number in the uncompiled pattern. */
-#define GET_UNSIGNED_NUMBER(num) \
+#define GET_UNSIGNED_NUMBER(num) \
{ if (p != pend) \
{ \
- PATFETCH (c); \
- while (ISDIGIT (c)) \
- { \
- if (num < 0) \
- num = 0; \
- num = num * 10 + c - '0'; \
- if (p == pend) \
- break; \
- PATFETCH (c); \
- } \
- } \
+ PATFETCH (c); \
+ while (ISDIGIT (c)) \
+ { \
+ if (num < 0) \
+ num = 0; \
+ num = num * 10 + c - '0'; \
+ if (p == pend) \
+ break; \
+ PATFETCH (c); \
+ } \
+ } \
}
#define CHAR_CLASS_MAX_LENGTH 6 /* Namely, `xdigit'. */
((fail_stack).size > re_max_failures * MAX_FAILURE_ITEMS \
? 0 \
: ((fail_stack).stack = (fail_stack_elt_t *) \
- REGEX_REALLOCATE ((fail_stack).stack, \
- (fail_stack).size * sizeof (fail_stack_elt_t), \
- ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \
+ REGEX_REALLOCATE ((fail_stack).stack, \
+ (fail_stack).size * sizeof (fail_stack_elt_t), \
+ ((fail_stack).size << 1) * sizeof (fail_stack_elt_t)), \
\
(fail_stack).stack == NULL \
? 0 \
- : ((fail_stack).size <<= 1, \
- 1)))
+ : ((fail_stack).size <<= 1, \
+ 1)))
/* Push PATTERN_OP on FAIL_STACK.
is wide enough to hold a value of something to which pointer can \
be assigned */ \
s_reg_t this_reg; \
- \
+ \
DEBUG_STATEMENT (failure_id++); \
DEBUG_STATEMENT (nfailure_points_pushed++); \
DEBUG_PRINT2 ("\nPUSH_FAILURE_POINT #%u:\n", failure_id); \
/* We actually push this many items. */
#define NUM_FAILURE_ITEMS \
- ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \
+ ((highest_active_reg - lowest_active_reg + 1) * NUM_REG_ITEMS \
+ NUM_NONREG_ITEMS)
/* How many items can still be added to the stack without overflowing it. */
/* Call before fetching a character with *d. This switches over to
string2 if necessary. */
#define PREFETCH() \
- while (d == dend) \
+ while (d == dend) \
{ \
/* End of string2 => fail. */ \
- if (dend == end_match_2) \
- goto fail; \
- /* End of string1 => advance to string2. */ \
- d = string2; \
+ if (dend == end_match_2) \
+ goto fail; \
+ /* End of string1 => advance to string2. */ \
+ d = string2; \
dend = end_match_2; \
}
string2, look at the last character in string1. */
#define WORDCHAR_P(d) \
(SYNTAX ((d) == end1 ? *string2 \
- : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
+ : (d) == string2 - 1 ? *(end1 - 1) : *(d)) \
== Sword)
/* Test if the character before D and the one at D differ with respect
alloc_path (void)
{
struct path * pp;
-
+
pp = (struct path *)MALLOC(sizeof(struct path));
if (pp) {
{
int i;
struct multipath * mpp;
-
+
if (!mpvec)
return NULL;
{
int i;
struct multipath * mpp;
-
+
if (!mpvec)
return NULL;
int i;
int len;
struct multipath * mpp;
-
+
if (!mpvec)
return NULL;
if (!len)
return NULL;
-
+
vector_foreach_slot (mpvec, mpp, i) {
if (strlen(mpp->alias) == len &&
!strncmp(mpp->alias, alias, len))
if (!pathvec)
return NULL;
-
+
vector_foreach_slot (pathvec, pp, i)
if (!strcmp_chomp(pp->dev, dev))
return pp;
retry:
if (dm_get_info(mpp->alias, &mpp->dmi)) {
/* Error accessing table */
- condlog(3, "%s: cannot access table", mpp->alias);
+ condlog(3, "%s: cannot access table", mpp->alias);
goto out;
}
if (!dm_map_present(mpp->alias)) {
/* Table has been removed */
- condlog(3, "%s: table does not exist", mpp->alias);
+ condlog(3, "%s: table does not exist", mpp->alias);
goto out;
}
if (!mpp->pg)
return 1;
-
+
vector_foreach_slot (mpp->pg, pgp, i) {
if (!pgp->paths)
continue;
}
/* enable receiving of the sender credentials */
- setsockopt(sock, SOL_SOCKET, SO_PASSCRED,
+ setsockopt(sock, SOL_SOCKET, SO_PASSCRED,
&feature_on, sizeof(feature_on));
} else {
{
int i;
char s1[PARAMS_SIZE],s2[PARAMS_SIZE];
-
+
if(!str1 || !str2)
return 1;
char * p;
int len;
int skip = 0;
-
+
if (word)
*word = NULL;
int ux_socket_connect(const char *name)
{
int fd;
- struct sockaddr_un addr;
+ struct sockaddr_un addr;
- memset(&addr, 0, sizeof(addr));
- addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path, name, sizeof(addr.sun_path));
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_UNIX;
+ strncpy(addr.sun_path, name, sizeof(addr.sun_path));
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd == -1) {
return -1;
}
-
+
if (connect(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
close(fd);
return -1;
/*
* create a unix domain socket and start listening on it
- * return a file descriptor open on the socket
+ * return a file descriptor open on the socket
*/
int ux_socket_listen(const char *name)
{
int fd;
- struct sockaddr_un addr;
+ struct sockaddr_un addr;
/* get rid of any old socket */
unlink(name);
fd = socket(AF_UNIX, SOCK_STREAM, 0);
if (fd == -1) return -1;
- memset(&addr, 0, sizeof(addr));
- addr.sun_family = AF_UNIX;
- strncpy(addr.sun_path, name, sizeof(addr.sun_path));
+ memset(&addr, 0, sizeof(addr));
+ addr.sun_family = AF_UNIX;
+ strncpy(addr.sun_path, name, sizeof(addr.sun_path));
- if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
+ if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) == -1) {
close(fd);
return -1;
- }
+ }
- if (listen(fd, 10) == -1) {
+ if (listen(fd, 10) == -1) {
close(fd);
return -1;
}
-/*
+/*
* Part: Vector structure manipulation.
- *
+ *
* Version: $Id: vector.c,v 1.0.3 2003/05/11 02:28:03 acassen Exp $
- *
+ *
* Author: Alexandre Cassen, <acassen@linux-vs.org>
- *
+ *
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
#include <stdlib.h>
#include "vector.h"
-/*
+/*
* Initialize vector struct.
* allocated 'size' slot elements then return vector.
*/
vector_insert_slot(vector v, int slot, void *value)
{
int i;
-
+
if (!vector_alloc_slot(v))
return NULL;
void stop_waiter_thread (struct multipath *mpp, struct vectors *vecs)
{
struct event_thread *wp = (struct event_thread *)mpp->waiter;
-
+
if (!wp) {
condlog(3, "%s: no waiter thread", mpp->alias);
return;
}
dm_task_no_open_count(waiter->dmt);
-
+
/* accept wait interruption */
set = unblock_signals();
lock_cleanup_pop(waiter->vecs->lock);
if (r) {
- condlog(2, "%s: event checker exit",
+ condlog(2, "%s: event checker exit",
waiter->mapname);
return -1; /* stop the thread */
}