setencstat.c (225736) | setencstat.c (246437) |
---|---|
1/* $FreeBSD: stable/9/share/examples/ses/srcs/setencstat.c 198934 2009-11-04 23:36:23Z delphij $ */ | 1/* $FreeBSD: stable/9/share/examples/ses/srcs/setencstat.c 246437 2013-02-06 22:07:38Z mav $ */ |
2/* 3 * Copyright (c) 2000 by Matthew Jacob 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 28 * SUCH DAMAGE. 29 * 30 * Matthew Jacob 31 * Feral Software 32 * mjacob@feral.com 33 */ 34 35#include <unistd.h> | 2/* 3 * Copyright (c) 2000 by Matthew Jacob 4 * All rights reserved. 5 * 6 * Redistribution and use in source and binary forms, with or without 7 * modification, are permitted provided that the following conditions 8 * are met: 9 * 1. Redistributions of source code must retain the above copyright --- 18 unchanged lines hidden (view full) --- 28 * SUCH DAMAGE. 29 * 30 * Matthew Jacob 31 * Feral Software 32 * mjacob@feral.com 33 */ 34 35#include <unistd.h> |
36#include <stddef.h> 37#include <stdint.h> |
|
36#include <stdlib.h> 37#include <stdio.h> 38#include <fcntl.h> 39#include <sys/ioctl.h> | 38#include <stdlib.h> 39#include <stdio.h> 40#include <fcntl.h> 41#include <sys/ioctl.h> |
40#include SESINC | 42#include <cam/scsi/scsi_all.h> 43#include <cam/scsi/scsi_enc.h> |
41 42int 43main(int a, char **v) 44{ 45 int fd; 46 long val; | 44 45int 46main(int a, char **v) 47{ 48 int fd; 49 long val; |
47 ses_encstat stat; | 50 encioc_enc_status_t stat; |
48 49 if (a != 3) { 50 fprintf(stderr, "usage: %s device enclosure_status\n", *v); 51 return (1); 52 } 53 fd = open(v[1], O_RDWR); 54 if (fd < 0) { 55 perror(v[1]); 56 return (1); 57 } 58 59 val = strtol(v[2], NULL, 0); | 51 52 if (a != 3) { 53 fprintf(stderr, "usage: %s device enclosure_status\n", *v); 54 return (1); 55 } 56 fd = open(v[1], O_RDWR); 57 if (fd < 0) { 58 perror(v[1]); 59 return (1); 60 } 61 62 val = strtol(v[2], NULL, 0); |
60 stat = (ses_encstat) val; 61 if (ioctl(fd, SESIOC_SETENCSTAT, (caddr_t) &stat) < 0) { 62 perror("SESIOC_SETENCSTAT"); | 63 stat = (encioc_enc_status_t)val; 64 if (ioctl(fd, ENCIOC_SETENCSTAT, (caddr_t) &stat) < 0) { 65 perror("ENCIOC_SETENCSTAT"); |
63 } 64 (void) close(fd); 65 return (0); 66} | 66 } 67 (void) close(fd); 68 return (0); 69} |