summaryrefslogtreecommitdiffstats
path: root/perl-install/raid.pm
Commit message (Expand)AuthorAgeFilesLines
* fix raid detection during install (#54706)Pascal Terjan2009-10-191-4/+3
* - factorize default FS definitionPascal Terjan2009-10-071-2/+2
* fix existing raid detection during install (#53159)Pascal Terjan2009-09-031-1/+5
* handle md devices not called md\d+, like md_d127Pascal Terjan2009-04-141-2/+2
* Only write raid config into $::prefix if we are in install mode (#49632)Pascal Terjan2009-04-091-1/+1
* make things more clearPascal Rigaux2008-09-151-1/+1
* fix check for mdadm in live install (#43785)Olivier Blin2008-09-151-1/+1
* - fix insmoding raid0 (#33172)Pascal Rigaux2007-09-051-2/+2
* - fix loading linux software raid (mdadm) kernel modulesPascal Rigaux2007-08-271-5/+11
* - diskdrake:Pascal Rigaux2007-08-211-0/+2
* re-sync after the big svn lossPascal Rigaux2007-04-251-5/+7
* use --force when creating a md with only one device (bugzilla #21214)Pascal Rigaux2006-02-201-1/+3
* we shouldn't rely on callers to load missing modules...Thierry Vignaud2005-12-221-0/+1
* "mdadm --detail --brief" doesn't contain "devices=..." anymore (since mdadm 1...Pascal Rigaux2005-10-181-1/+1
* write /etc/mdadm.conf when creating a new md (bugzilla #15502)Pascal Rigaux2005-08-081-1/+2
* - move functions using /proc/partitions out of fsedit to fs::proc_partitionsPascal Rigaux2005-06-101-1/+0
* don't need prefixing with current packagePascal Rigaux2005-06-091-1/+1
* remove unused codePascal Rigaux2005-06-031-4/+0
* calling inactivate_and_dirty() on a new structure is bad, we loose the {isFor...Pascal Rigaux2005-03-241-4/+5
* ensure we use/propose a free md when creating a new onePascal Rigaux2005-03-241-1/+6
* after "mdadm --assemble" there can be some mds in inactivate state busying de...Pascal Rigaux2005-03-241-1/+9
* switch back to auto=yes :Pascal Rigaux2005-01-271-1/+1
* fix "mdadm package not installed" during install (bugzilla #13259)Pascal Rigaux2005-01-271-1/+1
* put the new option auto=dev instead of auto=yes (see mdadm-1.8.0-2mdk)Pascal Rigaux2005-01-231-1/+1
* - don't write /etc/mdadm.conf when no raidPascal Rigaux2005-01-211-1/+3
* - fs::format::part_raw() now takes $wait_message to allow displaying the prog...Pascal Rigaux2005-01-061-1/+1
* better english (writing style rather than spoken one)Thierry Vignaud2004-12-131-1/+1
* remove some unneeded ";", add some for normalization (as told by perl_checker)Pascal Rigaux2004-11-181-1/+1
* since we need mdadm, ensure we have it (bugzilla #12146)Pascal Rigaux2004-10-271-0/+5
* newly created raids must have a fs_type (this was dropped in rev 1.45, it was...Pascal Rigaux2004-10-261-0/+1
* put UUID instead of devices in mdadm.conf to be more device naming independantPascal Rigaux2004-10-141-13/+22
* saferPascal Rigaux2004-09-061-2/+3
* fix typoPascal Rigaux2004-09-061-3/+4
* handle pt_type, not only fs_typePascal Rigaux2004-09-061-2/+5
* be more failsafe with half broken existing raidsPascal Rigaux2004-09-061-0/+1
* remove dead codePascal Rigaux2004-08-101-4/+0
* - switch to mdadm (instead of raidtools)Pascal Rigaux2004-08-081-76/+128
* - add field {fs_type} partially replacing {pt_type}Pascal Rigaux2004-07-271-5/+5
* - move format related functions out of fs.pm to new module fs/format.pmPascal Rigaux2004-07-231-1/+1
* big renaming of field {type} to {pt_type},Pascal Rigaux2004-07-051-1/+1
* perl now handle cleanly utf8 string in exceptions, no need to die \N("...")Pascal Rigaux2004-04-051-2/+2
* perl_checker adaptations + fixesPascal Rigaux2003-04-241-2/+2
* to workaround perl bug removing UTF8 flag when passing scalars to die's, passGuillaume Cottenceau2003-02-191-2/+2
* mkraid wants all the md devices written in raidtab to exist, even if asking toPascal Rigaux2003-02-191-2/+2
* cleanupPascal Rigaux2003-02-191-2/+6
* perl_checker compliance ("ref" now need parentheses in many case)Pascal Rigaux2003-02-121-1/+1
* software raid (mdX) can go up to md31Pascal Rigaux2003-01-291-1/+3
* use "if any" instead of "if grep", and various other occurences of "any", "ev...Pascal Rigaux2003-01-071-1/+1
* use output()Pascal Rigaux2002-12-031-14/+13
* testing awareGuillaume Cottenceau2002-11-281-0/+1
kwb">static void cbcp_protrej __P((int unit)); static int cbcp_printpkt __P((u_char *pkt, int len, void (*printer) __P((void *, char *, ...)), void *arg)); struct protent cbcp_protent = { PPP_CBCP, cbcp_init, cbcp_input, cbcp_protrej, cbcp_lowerup, NULL, cbcp_open, NULL, cbcp_printpkt, NULL, 0, "CBCP", NULL, cbcp_option_list, NULL, NULL, NULL }; cbcp_state cbcp[NUM_PPP]; /* internal prototypes */ static void cbcp_recvreq __P((cbcp_state *us, char *pckt, int len)); static void cbcp_resp __P((cbcp_state *us)); static void cbcp_up __P((cbcp_state *us)); static void cbcp_recvack __P((cbcp_state *us, char *pckt, int len)); static void cbcp_send __P((cbcp_state *us, u_char code, u_char *buf, int len)); /* option processing */ static int setcbcp(argv) char **argv; { lcp_wantoptions[0].neg_cbcp = 1; cbcp_protent.enabled_flag = 1; cbcp[0].us_number = strdup(*argv); if (cbcp[0].us_number == 0) novm("callback number"); cbcp[0].us_type |= (1 << CB_CONF_USER); cbcp[0].us_type |= (1 << CB_CONF_ADMIN); return (1); } /* init state */ static void cbcp_init(iface) int iface; { cbcp_state *us; us = &cbcp[iface]; memset(us, 0, sizeof(cbcp_state)); us->us_unit = iface; us->us_type |= (1 << CB_CONF_NO); } /* lower layer is up */ static void cbcp_lowerup(iface) int iface; { cbcp_state *us = &cbcp[iface]; dbglog("cbcp_lowerup"); dbglog("want: %d", us->us_type); if (us->us_type == CB_CONF_USER) dbglog("phone no: %s", us->us_number); } static void cbcp_open(unit) int unit; { dbglog("cbcp_open"); } /* process an incomming packet */ static void cbcp_input(unit, inpacket, pktlen) int unit; u_char *inpacket; int pktlen; { u_char *inp; u_char code, id; u_short len; cbcp_state *us = &cbcp[unit]; inp = inpacket; if (pktlen < CBCP_MINLEN) { error("CBCP packet is too small"); return; } GETCHAR(code, inp); GETCHAR(id, inp); GETSHORT(len, inp); #if 0 if (len > pktlen) { error("CBCP packet: invalid length"); return; } #endif len -= CBCP_MINLEN; switch(code) { case CBCP_REQ: us->us_id = id; cbcp_recvreq(us, inp, len); break; case CBCP_RESP: dbglog("CBCP_RESP received"); break; case CBCP_ACK: if (id != us->us_id) dbglog("id doesn't match: expected %d recv %d", us->us_id, id); cbcp_recvack(us, inp, len); break; default: break; } } /* protocol was rejected by foe */ void cbcp_protrej(int iface) { } char *cbcp_codenames[] = { "Request", "Response", "Ack" }; char *cbcp_optionnames[] = { "NoCallback", "UserDefined", "AdminDefined", "List" }; /* pretty print a packet */ static int cbcp_printpkt(p, plen, printer, arg) u_char *p; int plen; void (*printer) __P((void *, char *, ...)); void *arg; { int code, opt, id, len, olen, delay; u_char *pstart; if (plen < HEADERLEN) return 0; pstart = p; GETCHAR(code, p); GETCHAR(id, p); GETSHORT(len, p); if (len < HEADERLEN || len > plen) return 0; if (code >= 1 && code <= sizeof(cbcp_codenames) / sizeof(char *)) printer(arg, " %s", cbcp_codenames[code-1]); else printer(arg, " code=0x%x", code); printer(arg, " id=0x%x", id); len -= HEADERLEN; switch (code) { case CBCP_REQ: case CBCP_RESP: case CBCP_ACK: while(len >= 2) { GETCHAR(opt, p); GETCHAR(olen, p); if (olen < 2 || olen > len) { break; } printer(arg, " <"); len -= olen; if (opt >= 1 && opt <= sizeof(cbcp_optionnames) / sizeof(char *)) printer(arg, " %s", cbcp_optionnames[opt-1]); else printer(arg, " option=0x%x", opt); if (olen > 2) { GETCHAR(delay, p); printer(arg, " delay = %d", delay); } if (olen > 3) { int addrt; char str[256]; GETCHAR(addrt, p); memcpy(str, p, olen - 4); str[olen - 4] = 0; printer(arg, " number = %s", str); } printer(arg, ">"); break; } default: break; } for (; len > 0; --len) { GETCHAR(code, p); printer(arg, " %.2x", code); } return p - pstart; } /* received CBCP request */ static void cbcp_recvreq(us, pckt, pcktlen) cbcp_state *us; char *pckt; int pcktlen; { u_char type, opt_len, delay, addr_type; char address[256]; int len = pcktlen; address[0] = 0; while (len) { dbglog("length: %d", len); GETCHAR(type, pckt); GETCHAR(opt_len, pckt); if (opt_len > 2) GETCHAR(delay, pckt); us->us_allowed |= (1 << type); switch(type) { case CB_CONF_NO: dbglog("no callback allowed"); break; case CB_CONF_USER: dbglog("user callback allowed"); if (opt_len > 4) { GETCHAR(addr_type, pckt); memcpy(address, pckt, opt_len - 4); address[opt_len - 4] = 0; if (address[0]) dbglog("address: %s", address); } break; case CB_CONF_ADMIN: dbglog("user admin defined allowed"); break; case CB_CONF_LIST: break; } len -= opt_len; } cbcp_resp(us); } static void cbcp_resp(us) cbcp_state *us; { u_char cb_type; u_char buf[256]; u_char *bufp = buf; int len = 0; cb_type = us->us_allowed & us->us_type; dbglog("cbcp_resp cb_type=%d", cb_type); #if 0 if (!cb_type) lcp_down(us->us_unit); #endif if (cb_type & ( 1 << CB_CONF_USER ) ) { dbglog("cbcp_resp CONF_USER"); PUTCHAR(CB_CONF_USER, bufp); len = 3 + 1 + strlen(us->us_number) + 1; PUTCHAR(len , bufp); PUTCHAR(5, bufp); /* delay */ PUTCHAR(1, bufp); BCOPY(us->us_number, bufp, strlen(us->us_number) + 1); cbcp_send(us, CBCP_RESP, buf, len); return; } if (cb_type & ( 1 << CB_CONF_ADMIN ) ) { dbglog("cbcp_resp CONF_ADMIN"); PUTCHAR(CB_CONF_ADMIN, bufp); len = 3; PUTCHAR(len, bufp); PUTCHAR(5, bufp); /* delay */ cbcp_send(us, CBCP_RESP, buf, len); return; } if (cb_type & ( 1 << CB_CONF_NO ) ) { dbglog("cbcp_resp CONF_NO"); PUTCHAR(CB_CONF_NO, bufp); len = 3; PUTCHAR(len , bufp); PUTCHAR(0, bufp); cbcp_send(us, CBCP_RESP, buf, len); start_networks(); return; } } static void cbcp_send(us, code, buf, len) cbcp_state *us; u_char code; u_char *buf; int len; { u_char *outp; int outlen; outp = outpacket_buf; outlen = 4 + len; MAKEHEADER(outp, PPP_CBCP); PUTCHAR(code, outp); PUTCHAR(us->us_id, outp); PUTSHORT(outlen, outp); if (len) BCOPY(buf, outp, len); output(us->us_unit, outpacket_buf, outlen + PPP_HDRLEN); } static void cbcp_recvack(us, pckt, len) cbcp_state *us; char *pckt; int len; { u_char type, delay, addr_type; int opt_len; char address[256]; if (len) { GETCHAR(type, pckt); GETCHAR(opt_len, pckt); if (opt_len > 2) GETCHAR(delay, pckt); if (opt_len > 4) { GETCHAR(addr_type, pckt); memcpy(address, pckt, opt_len - 4); address[opt_len - 4] = 0; if (address[0]) dbglog("peer will call: %s", address); } if (type == CB_CONF_NO) return; } cbcp_up(us); } /* ok peer will do callback */ static void cbcp_up(us) cbcp_state *us; { persist = 0; lcp_close(0, "Call me back, please"); status = EXIT_CALLBACK; }